<template>
  <div id="backconk">
    <div class="meituan-content">
      <div class="login-cont">
        <div class="meituan-title">安智后台管理系统</div>
        <div class="meituan-user">
          <p>账号</p>
          <el-input v-model="account" class=inptflex placeholder="请输入账号" />
        </div>
        <div class="meituan-user">
          <p>密码</p>
          <el-input v-model="password" class=inptflex placeholder="请输入密码" />
        </div>

        <div class="reg-view " @click="regi = regi === '登录' ? '注册' : '登录'">
          <p>{{ regi }}</p>
        </div>

        <el-button v-if="regi == '注册'" @click="signin" type="success" class="meituan-btn">登录</el-button>
        <el-button v-else type="success" @click="register" class="meituan-btn">注册</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import { getCurrentInstance, reactive, toRefs } from 'vue'
import { inject } from 'vue';  

export default {
  setup() {
    const {proxy} = getCurrentInstance()
    const user = reactive({
      account: '',
      password: '',
      regi: '注册'
    })

    const signin = () => {

    }
    const register = async() => {
      // const requestInstance = new proxy.$request(); // 使用类来创建实例
  
      const obj = {account:user.account, password:user.password}
      const res = await new proxy.$request(proxy.$urls.m().register, obj).modePost()
      console.log(res)


    }
    return { ...toRefs(user), signin, register}
  }
}

</script>

<style></style>